if (typeof String.prototype.endsWith !== 'function') {
    String.prototype.endsWith = function(suffix) {
        return this.indexOf(suffix, this.length - suffix.length) !== -1;
    };
}
if (!String.prototype.hasOwnProperty("endWith")){
	String.prototype.endWith = function (a) {
		var isExp = a.constructor.name === "RegExp",
		val = this;
		if (isExp === false) {
			a = escape(a);
			val = escape(val);
		} else
			a = a.toString().replace(/(^\/)|(\/$)/g, "");
		return eval("/" + a + "$/.test(val)");
	}
}
function makeSuffixRegExp(suffix, caseInsensitive) {
  return new RegExp(
      String(suffix).replace(/[$%()*+.?\[\\\]{|}]/g, "\\$&") + "$",
      caseInsensitive ? "i" : "");
}

